cmake_minimum_required(VERSION 3.16.3)

project ( hello_world_prj )


#判断编译器类型,如果是gcc编译器,则在编译选项中加入c++11支持
if(CMAKE_COMPILER_IS_GNUCXX)
   set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
   message(STATUS "optional:-std=c++11")
endif(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
if(CMAKE_VERSION VERSION_LESS "3.7.0")
   set(CMAKE_INCLUDE_CURRENT_DIR ON)
endif()
find_package(Qt5 COMPONENTS Core Gui Qml Quick Widgets Network REQUIRED)
find_package(Qt5DBus REQUIRED)
find_package(PkgConfig REQUIRED)



set( SHARED_LIB_SOURCES
    src/Hello.cpp
)

set( EXE_SOURCES
    src/main.cpp
)

include_directories(src)
# 生成动态库
add_library( hello_world_shared_library SHARED 
    ${SHARED_LIB_SOURCES}
)
# 添加头文件目录
target_include_directories( hello_world_shared_library
    PUBLIC 
        ${PROJECT_SOURCE_DIR}/include
)
target_link_libraries( hello_world_shared_library
   PRIVATE
   Qt5::Widgets
   Qt5::DBus
)





# # 生成可执行文件
# add_executable( hello_world_exe  ${EXE_SOURCES} )

# target_include_directories( hello_world_exe
#     PRIVATE 
#         ${PROJECT_SOURCE_DIR}/include
# )
# # 链接对象库
# target_link_libraries( hello_world_exe 
#     PRIVATE 
#         hello_world_shared_library
# )





